//
//  MSNearByDetailView.m
//  MSJD
//
//  Created by xiangbo on 2018/12/8.
//  Copyright © 2018 xiangbo. All rights reserved.
//

#import "MSNearByDetailView.h"

@implementation MSNearByDetailView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(15);
            make.bottom.equalTo(self).offset(-25);
            make.width.equalTo(self.backImage.mas_height);
            make.left.equalTo(self).offset(20);
        }];
        
        self.descView = [[MSVerticalDescDetailView alloc] init];
        [self addSubview:self.descView];

        [self.descView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backImage.mas_right).offset(10);
            make.right.equalTo(self);
            make.centerY.equalTo(self.backImage);
            make.height.mas_equalTo(96.f);
        }];
        
        UIView *spaceView = [[UIView alloc] init];
        spaceView.backgroundColor = UIColorHex(0xf2f2f2);
        [self addSubview:spaceView];
        
        [spaceView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.backImage.mas_bottom).offset(15);
            make.left.right.bottom.equalTo(self);
        }];
    }
    return self;
}

- (void)configData:(id)data indexPath:(NSIndexPath *)indexPath{
    [self setDetailData:data];
}

- (void)setDetailData:(id)detailData{
    [super setDetailData:detailData];
    self.descView.contentData = detailData;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
